home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / Container / Sources / Commands.h < prev    next >
Encoding:
Text File  |  1996-04-25  |  6.4 KB  |  235 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Commands.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef COMMANDS_H
  11. #define COMMANDS_H
  12.  
  13. // ----- FrameWork Includes -----
  14.  
  15. #ifndef FWCMD_H
  16. #include "FWCmd.h"
  17. #endif
  18.  
  19. #ifndef FWCLPCMD_H
  20. #include "FWClpCmd.h"
  21. #endif
  22.  
  23. #ifndef FWDRCMD_H
  24. #include "FWDrCmd.h"
  25. #endif
  26.  
  27. #ifndef FWINSCMD_H
  28. #include "FWInsCmd.h"
  29. #endif
  30.  
  31. //========================================================================================
  32. //    Forward Declarations
  33. //========================================================================================
  34.  
  35. class FW_CFrame;
  36.  
  37. class CContainerPart;
  38. class CContainerFrame;
  39. class CContainerSelection;
  40. class CBaseContent;
  41. class CUndoContent;
  42.  
  43. //========================================================================================
  44. //     Constants - Command numbers
  45. //========================================================================================
  46.  
  47. const ODCommandID cResizeCommand        = 3006;
  48.  
  49. //========================================================================================
  50. // CClipboardCommand
  51. //========================================================================================
  52.  
  53. class CClipboardCommand : public FW_CClipboardCommand
  54. {
  55. public:
  56.  
  57.       FW_DECLARE_AUTO(CClipboardCommand)
  58.  
  59.     CClipboardCommand(Environment* ev, 
  60.                       ODCommandID commandID,
  61.                       CContainerPart* part, 
  62.                       CContainerFrame* frame, 
  63.                       CContainerSelection* selection,
  64.                       FW_Boolean canUndo);
  65.  
  66.     virtual ~ CClipboardCommand();
  67.  
  68.     // --- FW_CCommand overrides
  69.     virtual void         UndoIt(Environment* ev);
  70.     virtual void         RedoIt(Environment* ev);
  71.     virtual void         SaveUndoState(Environment* ev);
  72.     virtual void         SaveRedoState(Environment* ev);
  73.     virtual void         FreeUndoState(Environment* ev);
  74.     virtual void         FreeRedoState(Environment* ev);
  75.  
  76.     // ----- FW_CClipboardCommand overrides -----
  77.     virtual void        PreCommand(Environment* ev);
  78.     virtual void         CommandDone(Environment* ev);
  79.  
  80. private:
  81.     CContainerPart*            fContainerPart;
  82.     CContainerSelection*    fContainerSelection;
  83.     CUndoContent*            fUndoContent;
  84. };
  85.  
  86. //========================================================================================
  87. // class CDragCommand - for dragging
  88. //========================================================================================
  89.  
  90. class CDragCommand : public FW_CDragCommand
  91. {
  92.   public:
  93.  
  94.       FW_DECLARE_AUTO(CDragCommand)
  95.  
  96.     CDragCommand(Environment* ev, 
  97.                  CContainerPart* part,
  98.                  FW_CFrame* frame,
  99.                  CContainerSelection* selection,
  100.                  FW_Boolean canUndo);
  101.  
  102.     virtual ~CDragCommand();
  103.  
  104.     // --- FW_CCommand overrides
  105.     virtual void         UndoIt(Environment* ev);
  106.     virtual void         RedoIt(Environment* ev);
  107.     virtual void         SaveUndoState(Environment* ev);
  108.     virtual void         FreeUndoState(Environment* ev);
  109.  
  110.   protected:
  111.     CContainerPart*            fContainerPart;
  112.     CContainerSelection*    fContainerSelection;
  113.     CUndoContent*            fDraggedContent;
  114.     ODShape*                fUpdateShape;
  115. };
  116.  
  117. //========================================================================================
  118. // class CDropCommand - for dropping
  119. //========================================================================================
  120.  
  121. class CDropCommand : public FW_CDropCommand
  122. {
  123.   public:
  124.  
  125.       FW_DECLARE_AUTO(CDropCommand)
  126.  
  127.     CDropCommand(Environment* ev, 
  128.                  CContainerPart* itsPart,
  129.                  FW_CFrame* frame,
  130.                  ODDragItemIterator* dropInfo, 
  131.                  ODFacet* facet, 
  132.                  const FW_CPoint& windowPoint,
  133.                  FW_Boolean canUndo);
  134.  
  135.     virtual ~ CDropCommand();
  136.  
  137.     // --- FW_CCommand overrides
  138.     virtual void UndoIt(Environment* ev);
  139.     virtual void RedoIt(Environment* ev);
  140.     virtual void SaveRedoState(Environment* ev);
  141.     virtual void FreeRedoState(Environment* ev);
  142.  
  143.     // --- FW_CDropCommand overrides
  144.     virtual FW_Boolean DoDrop(Environment* ev, 
  145.                             ODStorageUnit* dropSU, 
  146.                             const FW_CPoint& mouseDownOffset, 
  147.                             const FW_CPoint& dropPoint, 
  148.                             FW_Boolean isDropMove,
  149.                             short itemNumber);
  150.     virtual FW_Boolean DoDroppedInSameFrame(Environment* ev, 
  151.                             ODStorageUnit* dropSU, 
  152.                             const FW_CPoint& mouseDownOffset, 
  153.                             const FW_CPoint& dropPoint);
  154.  
  155.   private:
  156.     void OffsetSelection(Environment* ev, const FW_CPoint& delta);
  157.     void RestoreDroppedProxies(Environment* ev);
  158.  
  159.   private:
  160.     CContainerPart*            fContainerPart;
  161.     CContainerSelection*    fContainerSelection;
  162.     FW_CPoint                fDropDelta;
  163.     CUndoContent*            fDroppedContent;
  164. };
  165.  
  166. //========================================================================================
  167. // CInsertCommand
  168. //========================================================================================
  169.  
  170. class CInsertCommand : public FW_CInsertCommand
  171. {
  172.   public:
  173.  
  174.       FW_DECLARE_AUTO(CInsertCommand)
  175.  
  176.     CInsertCommand(Environment* ev, 
  177.                     CContainerFrame* frame, 
  178.                     const FW_PFileSpecification& fileSpec, 
  179.                     CContainerSelection* selection,
  180.                     FW_Boolean canUndo);
  181.     virtual ~CInsertCommand();
  182.  
  183.     // --- FW_CCommand overrides
  184.     virtual void         UndoIt(Environment* ev);
  185.     virtual void         RedoIt(Environment* ev);
  186.     virtual void         SaveRedoState(Environment* ev);
  187.     virtual void         FreeRedoState(Environment* ev);
  188.  
  189.   public:
  190.     virtual void        PreCommand(Environment* ev);
  191.     virtual void         CommandDone(Environment* ev);
  192.  
  193.   private:
  194.     CContainerSelection*    fContainerSelection;
  195.     CUndoContent*            fUndoContent;
  196. };
  197.  
  198. //========================================================================================
  199. // class CResizeCommand - Change size of selected proxies
  200. //========================================================================================
  201.  
  202. class CResizeCommand : public FW_CCommand
  203. {
  204.   public:
  205.   
  206.       FW_DECLARE_AUTO(CResizeCommand)
  207.  
  208.     CResizeCommand (Environment* ev, 
  209.                     CContainerPart* part,
  210.                     FW_CFrame* frame,
  211.                     CContainerSelection* selection,
  212.                     const FW_CRect& srcRect,
  213.                     const FW_CRect& dstRect);
  214.  
  215.     virtual ~ CResizeCommand();
  216.  
  217.     // --- Command overrides
  218.     virtual void DoIt(Environment* ev);
  219.     virtual void UndoIt(Environment* ev);
  220.     virtual void RedoIt(Environment* ev);
  221.  
  222.   private:
  223.     void ResizeProxies(Environment* ev, const FW_CRect& srcRect, const FW_CRect& dstRect);
  224.     void Redraw(Environment* ev, ODDoneState doneState);
  225.  
  226.   protected:
  227.     CContainerPart*            fContainerPart;
  228.     CContainerSelection*    fContainerSelection;
  229.     FW_CRect                fSourceRect;
  230.     FW_CRect                fDestRect;
  231.     ODShape*                fUpdateShape;
  232.     CBaseContent*            fChangedContent;
  233. };
  234.  
  235. #endif